package gitee.derumin.lifeissohard.effects;

import gitee.derumin.lifeissohard.tools.CustomDamageSources;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;

public class Bleeding extends StatusEffect {
    protected Bleeding(StatusEffectCategory category, int color) {
        super(category, color);
    }

    @Override
    public boolean canApplyUpdateEffect(int duration, int amplifier){
        int i;
        i = 100/(amplifier+1);
        if (i > 0){
            return duration % i == 0;
        }else return true;
    }

    @Override
    public void applyUpdateEffect(LivingEntity entity, int amplifier){
        entity.damage(CustomDamageSources.BLEEDING,1f);
    }

    @Override
    public Bleeding addAttributeModifier(EntityAttribute attribute, String uuid, double amount, EntityAttributeModifier.Operation operation) {
        super.addAttributeModifier(attribute,uuid,amount,operation);
        return this;
    }
}
